var redisHelper = require('../helper/redisHelper');

redisHelper = new redisHelper();

// process.on('uncaughtException', function(e) {
// 	console.log('uncaughtException: ' + e);
// });
// 

var d = require('domain').create();

d.on('error', function(er) {
	// 不调用 process.on('uncaughtException' function(er) {});
	console.log('error, but oh well', er.message);
});

d.run(function() {
	// 阻塞事件
	console.log('message');

	// step2
	var push_Token = redisHelper.get('guest00000000-4df8-d963-3b64-93f651a1e20a_pushToken', function(error, reply) {
		if(reply === null) {
			console.log('reply: ' + reply);
			// return;
		}
		console.log("error: " + error); // null
		// console.log(reply); // 5d0355d4-d9b0-4c62-afb3-3ccbf0fc582f@1400493224000
		console.log(push_Token); // undefined
		console.log(12);
	});

	// step1
	console.log(push_Token.username); // 遇到错误了，这个闭包就暂停了

	console.log("ssssssss");

});


console.log('ssssss');
